package com.cloud.controller;

import com.cloud.service.PaymentFeignService;
import com.cloud.entity.CommonResult;
import com.cloud.entity.Payment;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * <h3>springcloud02</h3>
 * <p></p>
 *
 * @author : zhengyue
 * @date : 2020-06-03 08:16
 **/
@RestController
public class OrderFeignController {

    @Autowired
    private PaymentFeignService paymentService;

    @GetMapping("/consumer/payment/get/{id}")
    public CommonResult<Payment> getPaymentById(@PathVariable("id") Long id) {
        CommonResult<Payment> paymentCommonResult = paymentService.get(id);
        return paymentCommonResult;
    }

    @GetMapping("/consumer/payment/feign/timeout")
    public String paymentFeignTimeout() {
        //openfeign-ribbon, 客户端一般默认等待一秒
        return paymentService.paymentFeignTimeout();
    }
}
